*** Settings ***
Documentation    TC10-Round Management AIR-Sanity Check
Resource    ../../Keywords/Common_Head.robot
Metadata    Author     Betty
Force Tags    P3
Metadata    ID    13563


*** Variables ***
${TenderTitle}    Regression Test by automation
${G_TENDERID}    

*** Test Cases ***
TC10-Round Management AIR-Sanity Check
    Step 1 1 Create A Tender With Following Attributes
    Step 2 Use Attachment AirTemplate Service_LevelCheck_all xlsx
    Step 3 Click On Next Template Management Button
    Step 4 In Step2 Select And Define Optional Columns
    Step 5 Click On Skip Button In Step4 In The Pop Up Skip Push
    Step 6 Click On Next Round Management Button
    Step 7 Click On Sanity Check Button
    Step 8 Close The Validation Setup Dialog
    Step 9 Click On Start Button
    Step 10 Close The Window And Reopen It
    Step 11 Click On Download IPT Update The File As Attachment
    Step 12 Download The Error Report
    Step 13 Upload The Updated File13
    Step 14 Summary UNSUCCESSFUL14
    Step 15 Upload The Updated File15
    Step 16 Summary UNSUCCESSFUL16
    Step 17 Upload The Updated File17
    Step 18 Summary UNSUCCESSFUL18
    Step 19 Upload The Updated File19
    Step 20 Summary UNSUCCESSFUL20
    Step 21 Upload The Updated File21
    Step 22 Click On Submit Button
    Step 23 Exchange Current Role To Project Owner
    Step 24 Click On Close Button
    Step 25 Select This Project Click On Delete Project Button
    Step 26 User Goes To Basic Data Management Tender List


*** Keywords ***
Step ${step} 1 Create A Tender With Following Attributes
    #************************Step 1******************************
    #  Do:
    #      1 Create a tender with following attributes
    #      Tender ID some numbers such as 202408151435001 you can
    #     input with current datetime and some random number to
    #     avoid duplicate validation
    #      Tender Title some value such as Regression Test by
    #     Wendy001
    #      Mode Air
    #      Deadline to TM current date 10 day
    #      Rate Validity From current date
    #      Rate Validity To current date 100 day
    #      Deputies NATZHANG
    #      Description for regression
    #      2 Create a project with following attributes
    #      Tender ID input as 1 created such as 202408151435001
    #     Regression Test by Wendy001
    #      Mode Air
    #      Deadline to TM one month after current date and time
    #      Rate validity from current date
    #      Rate validity to one month after current date
    #      Deputies NATZHANG
    #      Descrpition test by wendy for sanity check
    #  Expected:
    #      The project creates successfully
    #************************************************************
    Login Space
    # Set Browser Timeout    20s
    # Set Browser Timeout    20s
    ${G_TENDERID}    Generate Tender ID
    Set Suite Variable    ${G_TENDERID}    ${G_TENDERID} 
    Create Tender    ${G_TENDERID}    ${TenderTitle}    815    true    true    true

    ${CurDate}    Get Current Date    result_format=%d/%m/%Y
    ${DealLineDate}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${FutureDate}    Get Current Date    UTC    +100days    result_format=%d/%m/%Y
    ${PROJECT}    Copy Dictionary    ${PROJECT_PARAM}
    Set To Dictionary    ${PROJECT}    
          ...    TENDER_ID=${G_TENDERID}    TENDER_TITLE=${TenderTitle}    CUSTOEMR_NAME=Miele    CUSTOMER_LEVEL=Global
          ...    MODE=AIR    DEADLINE_TM_DATE=${DealLineDate}    VALID_FROM=${CurDate}    VALID_TO=${FutureDate}    DEPUTY=NATZHANG
          ...    TEMPLATE=${CURDIR}${/}TestData${/}TC10-AirTemplate-Service_LevelCheck_all.xlsx
    Set Test Variable    ${PROJECT}    ${PROJECT}
    Create Project    ${PROJECT}

Step ${step} Use Attachment AirTemplate Service_LevelCheck_all xlsx
    #************************Step 2******************************
    #  Do:
    #      Use attachment AirTemplate Service_LevelCheck_all xlsx
    #     to do data cleaning
    #      Mapping Columns are
    #      Origin Country country from F
    #      Destination Country country to I
    #      Origin City city from E
    #      Destination City city to H
    #      Origin State State From G
    #      Destination State State To J
    #      DB Schenker Service Level Schenker Service Level C
    #      MD LD MD LD K
    #      Transit Time Door to Airport in hours Transit Time Door
    #     to Airport in hours L
    #      Transit Time Airport to Airport in hours Transit Time
    #     Airport to Airport in hours M
    #      Transit Time Airport to Door in hours Transit Time
    #     Airport to Door in hours N
    #      Transit Time Door to Door in hours Transit Time Door to
    #     Door in hours O
    #      Click on Start button
    #  Expected:
    #      Summary Successful
    #      Please close this page and go to Generate Internal
    #     Pricing Template
    #************************************************************
    ${DCTemplateFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-AirTemplate-Service_LevelCheck_all.xlsx
    Data Cleaning_TC10    Location    ${DCTemplateFile}
    # Data Cleaning
    Log    1
    
Step ${step} Click On Next Template Management Button
    #************************Step 3******************************
    #  Do:
    #      Click on Next Template Management button
    #  Expected:
    #      The Template Management window is pop up
    #************************************************************
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Template_gotoNextButton}

Step ${step} In Step2 Select And Define Optional Columns
    #************************Step 4******************************
    #  Do:
    #      In Step2 Select and Define Optional Columns
    #      Select all of the check boxes except the TBN columns
    #      Click Start button in Step 3
    #  Expected:
    #      100
    #      Summary Successful
    #      26 lanes has been generated in Internal Pricing
    #     Template
    #      If you want to change some columns in Internal Template
    #     please repeat step 2 and 3
    #************************************************************
    Sleep    5
    Wait Until Search Finished
    Template Management_TC10

Step ${step} Click On Skip Button In Step4 In The Pop Up Skip Push
    #************************Step 5******************************
    #  Do:
    #      Click on Skip button in Step4 in the pop up Skip push
    #     pricing window click on Yes
    #  Expected:
    #      Summary Skip Successfully Please go to Round Management
    #     to continue
    #************************************************************
    Push Skip and check for AIR Template

Step ${step} Click On Next Round Management Button
    #************************Step 6******************************
    #  Do:
    #      Click on Next Round Management button
    #  Expected:
    #      Round management window is pop up
    #************************************************************
    Wait Until Search Finished
    Wait Until Keyword Succeeds   20x    500ms    Get Element States    ${Template_gotoNextButton}    contains    visible
    Wait Until Keyword Succeeds    10x    100ms    Click    ${Template_gotoNextButton}
    Wait Until Search Finished
    Wait For Elements State    ${Project_RoundMgmt_SanityCheckButton}    enabled    60

Step ${step} Click On Sanity Check Button
    #************************Step 7******************************
    #  Do:
    #      Click on Sanity Check button
    #      Download Sanity Configuration check file
    #      Download X Ray quote check file
    #  Expected:
    #      The two downloaded files should be the same as
    #     attachments 8122024 AIR
    #     riot_SanityCheckConfiguration_08162024_Nh xlsx and
    #     Lane_08162024_jT xlsx
    #************************************************************
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SanityCheckButton}
    Wait Until Search Finished
    ${DSanityCheckfilename}    Download File    ${Project_RoundMgmt_SanityCheck_laneDownloadButton}
    Wait Until Search Finished
    Set Suite Variable    ${DSanityCheckfilename}    ${DSanityCheckfilename}
    ${SanityCheckfilename}    Set Variable    ${CURDIR}${/}TestData${/}TC10-Air-Step7_SanityCheck.xlsx
    Close All Excel Documents
    Compare Excel Value    ${DSanityCheckfilename}    ${SanityCheckfilename}    50    28    sheetName=Air

    Wait Until Search Finished
    ${DXRayfilename}    Download File    ${Project_RoundMgmt_X-RayCheck_laneDownloadButton}
    Set Suite Variable    ${DXRayfilename}    ${DXRayfilename}
    Wait Until Search Finished
    ${XRayfilename}    Set Variable    ${CURDIR}${/}TestData${/}TC10-Air-Step7_LaneCheck.xlsx
    Close All Excel Documents
    Compare Excel Value    ${DXRayfilename}    ${XRayfilename}    50    28    sheetName=X-rays countries

Step ${step} Close The Validation Setup Dialog
    #************************Step 8******************************
    #  Do:
    #      Close the Validation Setup dialog
    #      Assign WENDJIAN as pricing lead of region APAC and NAM
    #  Expected:
    #      Assign successfully
    #************************************************************
    Click    ${Project_RoundMgmt_SanityCheck_CancelButton}
    Wait Until Search Finished
    Wait For Elements State    //input[@id='regionAssignmet_Date_0_0']    visible    30
    Input Deadline In Region Tab    0    0
    Input Deadline In Region Tab    0    1
    # ${deadline_Count}    get element count    //input[@placeholder='DD/MM/YYYY']
    # # ${index}    Set Variable    1
    # FOR    ${loop}    IN RANGE    ${deadline_Count}
    #     ${status}    Run Keyword And Return Status    Wait For Elements State  (//input[@placeholder='DD/MM/YYYY'])[${loop+1}]    enabled    timeout=10s
    #      IF    '${status}'=='True'
    #         Fill Text    (//input[@placeholder='DD/MM/YYYY'])[${loop+1}]    ${CurDate}
    #         Wait Until Search Finished
    #     END
    # END
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_AssignButton}
    Wait For Elements State    ${Project_RoundMgmt_Assign_ApacTab}    visible    30
    Wait For Elements State    ${Project_RoundMgmt_Assign_ApacTab}    enabled    30
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_ApacTab}    xpath= //div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_NamTab}    xpath = //div[@class='shuttle-list ng-pristine ng-scope ng-isolate-scope ng-valid ng-valid-required']//b[.='Wendy Jiang (WENDJIAN)']

Step ${step} Click On Start Button
    #************************Step 9******************************
    #  Do:
    #      Click on Start button
    #      In the Are you sure to start round1 click on Yes button
    #      Click on Send button
    #  Expected:
    #      The window is closed
    #************************************************************
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    Click    ${Project_RoundMgmt_StartButton}
    Wait Until Keyword Succeeds    10x    100ms    Click    ${Project_RoundMgmt_StartConfirmButton} 
    Wait Until Search Finished
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished

Step ${step} Close The Window And Reopen It
    #************************Step 10******************************
    #  Do:
    #      Close the window and reopen it
    #      Change the Role to be Regional Pricing Manager APAC NAM
    #      Assign no user to be coutry and cluster pricing lead
    #     send notification
    #  Expected:
    #      Just wait a few seconds and a successful tip is
    #     appeared
    #************************************************************
    Click    ${Project_RoundMgmt_CloseButton}
    Close Browser
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Click    ${Project_toolbar_RoundMgmtButton}
    Wait For Elements State    ${Project_RoundMgmt_CurrentRole}    enabled    60
    Assign My Current Role    Regional Pricing Manager(NAM,APAC)
    Sleep    3
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_AssignButton}
    Wait For Elements State    xpath = //a[.='CN-C']    visible    30    
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    # Click    xpath = //a[.='CN-N']
    # Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    xpath = //a[.='US']
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    xpath = //form[@name='assignmentForm']//a[.='Cluster']
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    xpath = //a[.='Greater China']
    Click if Enabled     ${Project_RoundMgmt_Assign_RemoveAll}
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Routing_Confirm_Approve}
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_SendNotifButton}
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished

Step ${step} Click On Download IPT Update The File As Attachment
    #************************Step 11******************************
    #  Do:
    #      Click on Download IPT update the file as attachment
    #      Click on Submission button
    #      Select all Segments in Step1
    #      Upload the updated file
    #      index php attachments get c6ee284c 588a 4b04 bcfa
    #     a5c564a7c773
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${IPT}    Download File    //button[.='Download IPT']
    Set Test Variable    ${IPT}    ${IPT}
    Wait Until Search Finished

    ${Step11TemplateFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-AIR-sanity check_Round1_IPT_step11_pickup validation.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step11TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        Please download the error report to get detailed information about the failed upload

Step ${step} Download The Error Report
    #************************Step 12******************************
    #  Do:
    #      Download the Error Report
    #      Check the excel file content
    #  Expected:
    #      Should contain such kind of errors
    #      index php attachments get f145c66f 4c37 4bd9 8fe6
    #     4cbe4e111b01
    #************************************************************
    ${DErrorReportFile}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    Set Suite Variable    ${DErrorReportFile}    ${DErrorReportFile}
    Wait Until Search Finished
    ${ErrorReportFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-Air-Step12_UploadReport_pickup validation.xlsx
    Close All Excel Documents
    Compare Excel Value    ${DErrorReportFile}    ${ErrorReportFile}    5    73    sheetName=REPORT
    
    # # ${filename}    Get Download File Name    UploadReport
    # Open Excel Document     ${filename}    ${PROJECT.MODE}
    # ${valueA}=        Read Excel Cell    1    1    REPORT
    # ${valueB}=        Read Excel Cell    1    2    REPORT
    # ${valueC}=        Read Excel Cell    1    3    REPORT
    # ${valueD}=        Read Excel Cell    1    4    REPORT
    # ${valueE}=        Read Excel Cell    1    5    REPORT
    # ${value1}=        Read Excel Cell    2    1    REPORT
    # ${value2}=        Read Excel Cell    2    5    REPORT
    # Should Be Equal    ${valueA}    Type
    # Should Be Equal    ${valueB}    Position
    # Should Be Equal    ${valueC}    Lane ID
    # Should Be Equal    ${valueD}    Description
    # Should Be Equal    ${valueE}    Sanity Check
    # Should Be Equal    ${value1}    Error
    # Should Be Equal    ${value2}    [Service Level Check]
    # Close All Excel Documents
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished

Step ${step} Upload The Updated File13
    #************************Step 13******************************
    #  Do:
    #      Upload the updated file index php attachments get
    #     1c5d06af fbe3 4087 a9eb 3a3162851f93
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${Step13TemplateFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-AIR-sanity check_Round1_IPT_step13_service level.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step13TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    Please download the error report to get detailed information about the failed upload
    

Step ${step} Summary UNSUCCESSFUL14
    #************************Step 14******************************
    #  Do:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #  Expected:
    #      Should contain such kind of errors index php
    #     attachments get 1045325d 6023 42ae 8aed 3bf73245a1a1
    #************************************************************
    # ${filename}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    # Wait Until Search Finished
    ${DErrorReportFile1}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    Set Suite Variable    ${DErrorReportFile1}    ${DErrorReportFile1}
    Wait Until Search Finished
    ${ErrorReportFile1}    Set Variable    ${CURDIR}${/}TestData${/}TC10-Air-Step14_UploadReport_service level.xlsx
    Close All Excel Documents
    Compare Excel Value    ${DErrorReportFile1}    ${ErrorReportFile1}    5    106    sheetName=REPORT
    # # ${filename}    Get Download File Name    UploadReport
    # Open Excel Document     ${filename}    ${PROJECT.MODE}
    # ${valueA}=        Read Excel Cell    1    1    REPORT
    # ${valueB}=        Read Excel Cell    1    2    REPORT
    # ${valueC}=        Read Excel Cell    1    3    REPORT
    # ${valueD}=        Read Excel Cell    1    4    REPORT
    # ${valueE}=        Read Excel Cell    1    5    REPORT
    # ${value1}=        Read Excel Cell    2    1    REPORT
    # ${value2}=        Read Excel Cell    2    5    REPORT
    # Should Be Equal    ${valueA}    Type
    # Should Be Equal    ${valueB}    Position
    # Should Be Equal    ${valueC}    Lane ID
    # Should Be Equal    ${valueD}    Description
    # Should Be Equal    ${valueE}    Sanity Check
    # Should Be Equal    ${value1}    Error
    # Should Be Equal    ${value2}    [Service Level Check]
    # Close All Excel Documents
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished

Step ${step} Upload The Updated File15
    #************************Step 15******************************
    #  Do:
    #      Upload the updated file index php attachments get
    #     1c5d06af fbe3 4087 a9eb 3a3162851f93
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${Step13TemplateFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-AIR-sanity check_Round1_IPT_step15_delivery.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step13TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    Please download the error report to get detailed information about the failed upload
    

Step ${step} Summary UNSUCCESSFUL16
    #************************Step 16******************************
    #  Do:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #  Expected:
    #      Should contain such kind of errors index php
    #     attachments get 1045325d 6023 42ae 8aed 3bf73245a1a1
    #************************************************************
    # ${filename}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    # Wait Until Search Finished
    ${DErrorReportFile1}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    Set Suite Variable    ${DErrorReportFile1}    ${DErrorReportFile1}
    Wait Until Search Finished
    ${ErrorReportFile1}    Set Variable    ${CURDIR}${/}TestData${/}TC10-Air-Step16_UploadReport_delivery.xlsx
    Close All Excel Documents
    Compare Excel Value    ${DErrorReportFile1}    ${ErrorReportFile1}    5    73    sheetName=REPORT
    # # ${filename}    Get Download File Name    UploadReport
    # Open Excel Document     ${filename}    ${PROJECT.MODE}
    # ${valueA}=        Read Excel Cell    1    1    REPORT
    # ${valueB}=        Read Excel Cell    1    2    REPORT
    # ${valueC}=        Read Excel Cell    1    3    REPORT
    # ${valueD}=        Read Excel Cell    1    4    REPORT
    # ${valueE}=        Read Excel Cell    1    5    REPORT
    # ${value1}=        Read Excel Cell    2    1    REPORT
    # ${value2}=        Read Excel Cell    2    5    REPORT
    # Should Be Equal    ${valueA}    Type
    # Should Be Equal    ${valueB}    Position
    # Should Be Equal    ${valueC}    Lane ID
    # Should Be Equal    ${valueD}    Description
    # Should Be Equal    ${valueE}    Sanity Check
    # Should Be Equal    ${value1}    Error
    # Should Be Equal    ${value2}    [Service Level Check]
    # Close All Excel Documents
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished

Step ${step} Upload The Updated File17
    #************************Step 13******************************
    #  Do:
    #      Upload the updated file index php attachments get
    #     1c5d06af fbe3 4087 a9eb 3a3162851f93
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${Step13TemplateFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-AIR-sanity check_Round1_IPT_step17_same lane.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step13TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    Please download the error report to get detailed information about the failed upload
    

Step ${step} Summary UNSUCCESSFUL18
    #************************Step 18******************************
    #  Do:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #  Expected:
    #      Should contain such kind of errors index php
    #     attachments get 1045325d 6023 42ae 8aed 3bf73245a1a1
    #************************************************************
    # ${filename}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    # Wait Until Search Finished
    ${DErrorReportFile1}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    Set Suite Variable    ${DErrorReportFile1}    ${DErrorReportFile1}
    Wait Until Search Finished
    ${ErrorReportFile1}    Set Variable    ${CURDIR}${/}TestData${/}TC10-Air-Step18_UploadReport_same lane.xlsx
    Close All Excel Documents
    Compare Excel Value    ${DErrorReportFile1}    ${ErrorReportFile1}    5    13    sheetName=REPORT
    # # ${filename}    Get Download File Name    UploadReport
    # Open Excel Document     ${filename}    ${PROJECT.MODE}
    # ${valueA}=        Read Excel Cell    1    1    REPORT
    # ${valueB}=        Read Excel Cell    1    2    REPORT
    # ${valueC}=        Read Excel Cell    1    3    REPORT
    # ${valueD}=        Read Excel Cell    1    4    REPORT
    # ${valueE}=        Read Excel Cell    1    5    REPORT
    # ${value1}=        Read Excel Cell    2    1    REPORT
    # ${value2}=        Read Excel Cell    2    5    REPORT
    # Should Be Equal    ${valueA}    Type
    # Should Be Equal    ${valueB}    Position
    # Should Be Equal    ${valueC}    Lane ID
    # Should Be Equal    ${valueD}    Description
    # Should Be Equal    ${valueE}    Sanity Check
    # Should Be Equal    ${value1}    Error
    # Should Be Equal    ${value2}    [Service Level Check]
    # Close All Excel Documents
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished

Step ${step} Upload The Updated File19
    #************************Step 19******************************
    #  Do:
    #      Upload the updated file index php attachments get
    #     1c5d06af fbe3 4087 a9eb 3a3162851f93
    #  Expected:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #************************************************************
    ${Step13TemplateFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-AIR-sanity check_Round1_IPT_step19_weight break.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step13TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    UNSUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains    Please download the error report to get detailed information about the failed upload
    

Step ${step} Summary UNSUCCESSFUL20
    #************************Step 20******************************
    #  Do:
    #      Summary UNSUCCESSFUL
    #      Please download the error report to get detailed
    #     information about the failed upload
    #  Expected:
    #      Should contain such kind of errors index php
    #     attachments get 1045325d 6023 42ae 8aed 3bf73245a1a1
    #************************************************************
    # ${filename}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    # Wait Until Search Finished
    ${DErrorReportFile1}    Download File    ${Project_RoundMgmt_Submit_ErrReportButton}
    Wait Until Search Finished
    Set Suite Variable    ${DErrorReportFile1}    ${DErrorReportFile1}
    Wait Until Search Finished
    ${ErrorReportFile1}    Set Variable    ${CURDIR}${/}TestData${/}TC10-Air-Step20_UploadReport_weight break.xlsx
    Close All Excel Documents
    Compare Excel Value    ${DErrorReportFile1}    ${ErrorReportFile1}    5    56    sheetName=REPORT
    # # ${filename}    Get Download File Name    UploadReport
    # Open Excel Document     ${filename}    ${PROJECT.MODE}
    # ${valueA}=        Read Excel Cell    1    1    REPORT
    # ${valueB}=        Read Excel Cell    1    2    REPORT
    # ${valueC}=        Read Excel Cell    1    3    REPORT
    # ${valueD}=        Read Excel Cell    1    4    REPORT
    # ${valueE}=        Read Excel Cell    1    5    REPORT
    # ${value1}=        Read Excel Cell    2    1    REPORT
    # ${value2}=        Read Excel Cell    2    5    REPORT
    # Should Be Equal    ${valueA}    Type
    # Should Be Equal    ${valueB}    Position
    # Should Be Equal    ${valueC}    Lane ID
    # Should Be Equal    ${valueD}    Description
    # Should Be Equal    ${valueE}    Sanity Check
    # Should Be Equal    ${value1}    Error
    # Should Be Equal    ${value2}    [Service Level Check]
    # Close All Excel Documents
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished

Step ${step} Upload The Updated File21
    #************************Step 21******************************
    #  Do:
    #      Upload the updated file index php attachments get
    #     9432735e dede 4985 9af3 b9c9701115af
    #  Expected:
    #      Summary SUCCESSFUL
    #      Your selected lanes have been uploaded
    #      Submit button is displayed
    #************************************************************
    ${Step15TemplateFile}    Set Variable    ${CURDIR}${/}TestData${/}TC10-AIR-sanity check_Round1_IPT_step21_Pass.xlsx
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${Step15TemplateFile}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    1s    Get Page Source    contains        SUCCESSFUL
    Wait Until Keyword Succeeds    10x    1s    Get Page Source    contains        Your selected lanes have been uploaded!

Step ${step} Click On Submit Button
    #************************Step 22******************************
    #  Do:
    #      Click on Submit button
    #  Expected:
    #      Summary SUCCESSFUL
    #      Your rates have been submitted
    #************************************************************
    Wait Until Keyword Succeeds    5x    400ms    Click    ${Project_RoundMgmt_Submit_SubmitButton}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        SUCCESSFUL
    Wait Until Keyword Succeeds    10x    400ms    Get Page Source    contains        Your rates have been submitted!

Step ${step} Exchange Current Role To Project Owner
    #************************Step 23******************************
    #  Do:
    #      Exchange current role to Project Owner
    #      Click on Close Round button
    #      In pop up dialog
    #      Select Send notification to all pricing manager
    #      User clicks yes button
    #  Expected:
    #      1 A prompt says Close Success
    #      2 Current Pricing Round 1 Closed 2 lanes
    #      3 There have new round button and reopen round button
    #************************************************************
    Click    ${Project_RoundMgmt_Submit_CloseButton}
    Wait Until Search Finished
    Wait For Elements State    ${Project_RoundMgmt_CurrentRole}    enabled    60
    Assign My Current Role    Project Owner
    Wait Until Search Finished
    Click    ${Project_RoundMgmt_CloseRoundButton}
    Wait Until Search Finished
    # Click    //span[contains(text(),"Send notification to regional pricing manager.")]
    Click    //button[contains(text(),"Yes")]
    Wait Until Search Finished

Step ${step} Click On Close Button
    #************************Step 24******************************
    #  Do:
    #      Click on Close button
    #      In Pricing Project page User selects TenderID Contains
    #     20240815
    #  Expected:
    #      The project could be found
    #************************************************************
    Click    ${Project_RoundMgmt_CloseButton}
    # Search Project    ${PROJECT.TENDER_ID}

Step ${step} Select This Project Click On Delete Project Button
    #************************Step 25******************************
    #  Do:
    #      Select this project click on Delete Project button
    #      Click Yes of the pop up confirm window
    #      If Delete Project button is disable do Data Cleaning
    #     and cancel first and then Delete Project button is
    #     enable
    #  Expected:
    #      System displays Project has been deleted
    #************************************************************
    Click DataClean For Delete
    # Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_toolbar_DataCleaningButton}
    # Click    //button[contains(., "Yes")]
    # Wait For Elements State    ${Data_toolbar_UploadButton}    visible    30
    # Click    ${Data_toolbar_CloseButton}
    # Click    //button[contains(., "Yes")]
    # Log    finish in 'tear Down'

Step ${step} User Goes To Basic Data Management Tender List
    #************************Step 26******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Search out the tender created in step1
    #      Click on Delete button
    #      Click on Yes button in the popup dialog
    #  Expected:
    #      System displays Tender has been deleted
    #************************************************************
    Log    finish in 'tear Down'

Data Cleaning_TC10
    [Arguments]    ${Select_By}=Location    ${DataCleaningTemplateFile}=${PROJECT.TEMPLATE}
    ${Modify_Value}    Set Variable    1
    # 1.User goes to Pricing Collaboration , Pricing Project
    # 2.User select the row
    Search Project    ${PROJECT.TENDER_ID}
    # 3.User clicks data cleaning button.
    Wait For Elements State    ${Project_toolbar_DataCleaningButton}    enabled    20
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_toolbar_DataCleaningButton}
    Wait Until Search Finished
    # 4.User clicks upload button.
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Data_toolbar_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${DataCleaningTemplateFile}
    Wait Until Search Finished
    Wait For Elements State    xpath=//input[@value='location']    visible    30    
    Data Upload Template    ${PROJECT.TENDER_ID}-${PROJECT.MODE}-${PROJECT.TENDER_TITLE}    ${PROJECT.TEMPLATE}
    # 5.User select location/Port routing.
    IF    '${Select_By}' == 'Location'
            Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_DataClean_RoutingLocation}
    ELSE
            Wait Until Keyword Succeeds    5x    300ms    Click    ${Project_DataClean_RoutingPort}
    END
    Wait For Elements State    ${FCL/AIR_Select_OriginCountry}    enabled    60
    Select Options By   ${FCL/AIR_Select_OriginCountry}    label    ${SPACE}${SPACE}country from - F    Country from - F
    Select Options By   ${FCL/AIR_Select_DestinationCountry}      label     ${SPACE}${SPACE}country to - I        Country to - I
    Select Options By   ${Origin_City}      label     ${SPACE}city from - E
    Select Options By   ${Destination_City}      label      ${SPACE}${SPACE}city to - H
    Select Options By   ${Origin_State}      label    State From - G    State from - G
    Select Options By   ${Destination_State}      label    State To - J
    Select Options By   ${DB_Schenker_Service_Level}      label    Schenker Service Level - C
    # Select Options By   ${Customer_Service_Level}      label    TSP - Transport Service Provider - B
    Select Options By   ${MD/LD}      label    MD/LD - K
    # Select Options By   ${Air_Customer_Lane_ID}      label    Lane ID code - D
    Select Options By   ${Transit_Time_DTA_inHours}      label    Transit Time Door to Airport in hours - L
    Select Options By   ${Transit_Time_ATA_inHours}      label    Transit Time Airport to Airport in hours - M
    Select Options By   ${Transit_Time_ATD_inHours}      label    Transit Time Airport to Door in hours - N
    Select Options By   ${Transit_Time_DTD_inHours}      label    Transit Time Door to Door in hours - O
    # Click    ${Project_DataClean_CustomerServiceLevel}
    # Click    ${Project_DataClean_CustomerLaneID} 
    Click    ${Project_DataClean_TransitTimeDtoA} 
    Click    ${Project_DataClean_TransitTimeAtoA} 
    Click    ${Project_DataClean_TransitTimeAtoD} 
    Click    ${Project_DataClean_TransitTimeDtoD} 
    # 6.User clicks start button.
    Click    ${Data_toolbar_StartButton}
    Wait Until Search Finished
    Wait For Elements State    ${Summary_Succ}    visible    30
    Wait For Elements State   ${Data_toolbar_DownloadButton}     enabled
    Get Element States    ${Data_toolbar_UploadAfterStartButton}    not contains    disabled
    Get Element States    ${Data_toolbar_SetPassButton}    not contains    disabled

Template Management_TC10
    Wait Until Search Finished
    Wait Until Search Finished
    Wait For Elements State    ${Template_Step1DownloadButton}    visible    60
    Get Element States    ${Template_Step1DownloadButton}    not contains    disabled
    Wait For Elements State    ${Template_Dialogtitle}    visible    
    Check Text Value    ${Template_Dialogtitle}    ${PROJECT.TENDER_ID}-${PROJECT.MODE}-${PROJECT.TENDER_TITLE}
    Check Text Value    ${Template_Step2title}    Step2: Select and Define Optional Columns
    Check Text Value    ${Template_Step3title}    Step3: Generate Internal Pricing Template
    Check Text Value    ${Template_Step3DownloadFlag}    on
    Wait Until Search Finished
    # 4 User clicks download button.
    ${filename}    Download File    ${Template_Step1DownloadButton}
    # ${filename}    Get Download File Name    ${PROJECT.TENDER_ID}-${PROJECT.MODE}-${PROJECT.TENDER_TITLE}_DC    zip
    # # 5 Select Column 
    # Select Column for AIR Template
    Check All Check Box for Dialog    Step2: Select and Define Optional Columns
    Uncheck ALL TBN Checkbox    Step2: Select and Define Optional Columns
    # 6 User clicks start button.
    Wait Until Search Finished
    Click    ${Template_StartButton}
    Wait Until Search Finished
    Wait Until Search Finished
    Wait Until Keyword Succeeds    20x    400ms    Get Page Source    contains        Successful
    Check Text Value    ${Template_Summary}    Successful